#include "MyArray.h"

void main()
{
	//Example for array of integer
	cout << "BEGIN EXAMPLES" << endl;
	
	int size = 5;
	MyArray<int> intArray(size);
	intArray.setElement(0,3);
	intArray.setElement(1,1);
	intArray.setElement(2,7);
	intArray.setElement(3,9);
	intArray.setElement(4,0);	
	//Print array (before sorting)
	cout << "Before sorting array of integer" << endl;
	for(int i = 0 ; i < size; ++i) {
		cout << intArray.getElement(i) << "\t";
	}
	//Set sorting algorithm
	SortingStrategy<int>* interchangeSort = new InterchangeSort<int>();
	intArray.setSortingStrategy(interchangeSort);
	intArray.sort();
	delete interchangeSort;
	//Print array (after sorting)
	cout << "After sorting array of integer" << endl;	
	for(int i = 0 ; i < size; ++i) {
		cout << intArray.getElement(i) << "\t";
	}
	cout << endl;

	//Example for array of floating point
	MyArray<float> floatArray(size);
	floatArray.setElement(0,3.11f);
	floatArray.setElement(1,1.22f);
	floatArray.setElement(2,3.123f);
	floatArray.setElement(3,0.128f);
	floatArray.setElement(4,9.587f);
	//Print array (before sorting)
	cout << endl << "Before sorting array of floating point" << endl;
	for(int i = 0 ; i < size; ++i) {
		cout << floatArray.getElement(i) << "\t";
	}
	//Set sorting algorithm
	SortingStrategy<float>* bubbleSort = new BubbleSort<float>();
	floatArray.setSortingStrategy(bubbleSort);
	floatArray.sort();
	delete bubbleSort;
	//Print array (after sorting)
	cout << "After sorting array of floating point" << endl;
	for(int i = 0 ; i < size; ++i) {
		cout << floatArray.getElement(i) << "\t";
	}
	cout << endl;

	cout << endl << "END OF EXAMPLES" << endl;
}